package Model;


import java.util.Iterator;
import java.util.Observable;
import java.util.TreeSet;


//import CheckBox.treeset;
import DataLayer.DaoAccount;;

public class Accounts extends Observable{
private static final int NUMBER_OF_NEEDED_RECORDS = 0;



private static Accounts single;
	

	
	private TreeSet<Account>  Accounts = new TreeSet<Account>();
	
	
	public void addAccount(Account r){
		Accounts.add(r);
		DaoAccount.getInstance().insertAccount(r);
		System.out.println("added");
		DaoAccount.selfDestroy();
		notifyObservers(Accounts);
	}
	
	public void loadAccount(){
//		TreeSet<Account> tSet = DaoAccount.getInstance().loadAccounts();
//	    
//	    Iterator<Account> itr = tSet.iterator();
//
//	    while (itr.hasNext()){
//	      System.out.println(itr.next());
//	    }
	 	
	}
	
	public void updateAccount(Account r){
		
	}
	
	public void deleteAccount(Account r){
		
	}

	public TreeSet<Account> getAccount() {
		return Accounts;
	}

	public void setAccounts(TreeSet<Account> accounts) {
		this.Accounts = accounts;
	}
	
	public static Accounts getInstance(){
		if(single == null){
			single = new Accounts();
		}
		return single;
	}

	public boolean save(Account r) {
		// TODO Auto-generated method stub
		return false;
	}
	
}


